package com.example.myapplication;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

public class ViewUtil {

    //view 必须是EditText类
    public static void hideOneInputMethod(Activity activity, View view) {
        //输入管理器
        InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
        //关闭键盘
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}
